﻿using Glue;
using Xunit;

namespace GlueTests.AutoRelaterTests
{
    public class When_automatially_relating_between_types_and_their_nullable_types
    {
        private readonly Mapping<DomainPerson, GuiPerson> mapping;

        public class DomainPerson
        {
            public int Age { get; set; }
        }

        public class GuiPerson
        {
            public int? Age { get; set; }
        }

        public When_automatially_relating_between_types_and_their_nullable_types()
        {
            mapping = new Mapping<DomainPerson, GuiPerson>();
        }

        [Fact]
        public void Should_not_automatically_relate_be_default()
        {
            mapping.AutoRelateEqualNames();
            Assert.Equal(0,mapping.Relations.Count);
        }

        [Fact]
        public void Should_automatically_relate_if_specified()
        {
            mapping.AutoRelateEqualNames(true);
            Assert.Equal(1, mapping.Relations.Count);
        }
    }
}
